var leaveModel = require("./leavemodel");

var leave = {
    list: function() { //管理员查看所有请假记录

    },
    listByUserid: function() { //普通员工查看自身

    },
    add: function(leaveinfo) { //普通员工添加
        return new Promise((resolve, reject) => {
            leaveModel.insertMany([leaveinfo], (err, data) => {
                var result = {};
                if (!err) {
                    result.code = 1;
                    result.msg = "新增成功";
                } else {
                    result.code = 0;
                    result.msg = "新增失败";
                }
                resolve(result);
            })

        })
    },
    updateById: function() { //给管理员审批

    }
}

module.exports = leave;